
import axios from 'axios';

const request = axios.create({
  baseURL:'/api'
})

request.interceptors.response.use(
  res=>{
    return res.data
  },
  err => {
    return err
  }
)

// 获取物料信息列表
export const getMateList = (params) =>{
  return request({
    url: "/stock/mateList",
    method: 'GET',
    params: params
  })
}

// 获取料架信息列表
export const getShelfList = (params) =>{
  return request({
    url: "/shelf/shelfList",
    method: 'GET',
    params: params,
  })
}

// 取出全部亮灯物料
export const takeOutByLight = (data) =>{
  return request({
    url: "/stock/takeOutLight",
    method: 'POST',
    data: data,
  })
}

// 单个物料取出
export const takeOut = (data) =>{
  return request({
    url: "/stock/takeOut",
    method: 'POST',
    data: data,
  })
}

// 新增料架
export const addShelf = (data) =>{
  return request({
    url: "/shelf/addShelf",
    method: 'POST',
    data: data,
  })
}

// 删除料架
export const delShelf = (data) =>{
  return request({
    url: "/shelf/delShelf",
    method: 'POST',
    data: data,
  })
}

// 料架开机
export const turnOnShelf = (data) =>{
  return request({
    url: "/shelf/turnOnShelf",
    method: 'POST',
    data: data,
  })
}

// 料架关机
export const turnOffShelf = (data) =>{
  return request({
    url: "/shelf/turnOffShelf",
    method: 'POST',
    data: data,
  })
}

// 料架关机
export const clearStock = (data) =>{
  return request({
    url: "/stock/clearStock",
    method: 'POST',
    data: data,
  })
}

// 获取系统信息
export const getSysInfos = (data) =>{
  return request({
    url: "/setting/getSysInfo",
    method: 'GET',
    data: data,
  })
}

// 开启MQ连接
export const startMQ = (data) =>{
  return request({
    url: "/setting/startMQ",
    method: 'POST',
    data: data,
  })
}

// 关闭MQ连接
export const stopMQ = (data) =>{
  return request({
    url: "/setting/stopMQ",
    method: 'POST',
    data: data,
  })
}

// 更新配置
export const updateSetting = (data) => {
  return request({
    url: "/setting/updateSetting",
    method: 'POST',
    data: data,
  })
}
